School Location Data

Here I'll be manipulating some of the school location data we have found.


In [2]:
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import seaborn
% matplotlib inline
seaborn.set()

In [3]:
school_data = pd.read_csv("../data/Directory-School-current.csv")

In [8]:
school_data.columns


Out[8]:
Index(['School ID', 'Name', 'Telephone', 'Fax', 'Email^', 'Principal*',
       'School website', 'Street', 'Suburb', 'City', 'Postal Address 1',
       'Postal Address 2', 'Postal Address 3', 'Postal Code', 'Urban Area',
       'School Type', 'Definition', 'Authority', 'Gender of Students',
       'Territorial Authority with Auckland Local Board', 'Regional Council',
       'Ministry of Education Local Office', 'Education Region',
       'General Electorate', 'Maori Electorate', 'Census Area Unit', 'Ward',
       'Community of Learning: ID', 'Community of Learning: Name',
       'Longitude ', 'Latitude', 'Decile', 'Total School Roll',
       'European/ Pakeha', 'Maori', 'Pasifika', 'Asian', 'MELAA', 'Other',
       'International Students'],
      dtype='object')

In [12]:
school_data.ix[:, ['Name', 'Longitude ', 'Latitude']].to_csv('../data/school_data.csv')

In [25]:
school_data.ix[:, ['Name', 'Longitude ', 'Latitude']]\
    .apply(lambda x: ~np.any(x.isnull()), axis = 1)\
    .pipe(lambda x: school_data.ix[x, ['Name', 'Longitude ', 'Latitude']])\
    .to_csv('../data/school_data.csv', index = False)

In [18]:
school_data.apply?